package day03;
//逻辑运算符
public class OperDemo3 {
    public static void main(String[] args) {
        //3）逻辑运算符：&&、||、！
        int a=5,b=10,c=5;
        boolean b1 = b>=a && b<c;
        System.out.println(b1);                     //false--true  &&  false
        System.out.println(b<=c && b>a);            //false--false &&  true
        System.out.println(a==b && c>b);            //false--false &&  false
        System.out.println(b!=c && a<b);            //true---true  &&  true
        int age = 40;
        System.out.println(age>=18 && age<=50);     //true---true  &&  true
        int score = 86;
        System.out.println(score>=0 && score<=100); //true---true  &&  true
        System.out.println("---------------------------------------------");
        System.out.println(b>=a || b<c);            //true---true  ||  false
        System.out.println(b<=c || b>a);            //true---false ||  true
        System.out.println(b!=c || a<b);            //true---true  ||  true
        System.out.println(a==b || b<c);            //false--false ||  false
        int score1 = 90;
        System.out.println(score1<0 || score1>100); //false--false ||  false

        boolean b2 = !(a<b);
        System.out.println(b2);                     //false--!true
        System.out.println(!(a>b));                 //true---!false
        System.out.println("---------------------------------------------");

        boolean b3 = a>b && c++>2;
        System.out.println(b3);                     //false--false &&  true(不执行)
        System.out.println(c);                      //5，发生短路了

        boolean b4 = a<b || c++>2;
        System.out.println(b4);                     //true---true  ||  true(不执行)
        System.out.println(c);                      //5，发生短路了
    }
}
